package top.infopub.mgr.common.page;


import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;

import com.github.pagehelper.Page;


/**
 * 分页实体  封装com.github.pagehelper.Page </br>
 * <B>暂时不使用该类</B>
 * @author Awoke
 * @version 2018年10月17日
 * @see Pager
 * @since
 */
@Deprecated
public class Pager<T> implements Serializable {

    private static final long serialVersionUID = 4692447290486907310L;

    /**
     * 每页显示的记录数
     */
    private int numPerPage;

    /**
     * 总页数
     */
    private int totalPages;

    /**
     * 当前页码
     */
    private int currentPage;

    /**
     * 记录起始行数
     */
    private int startIndex;

    /**
     * 记录结束行数
     */
    private int lastIndex;

    /**
     * 记录总数 （命名必须为total 对应easyui分页）
     */
    private long total = 0;

    /**
     * 结果集存放List （命名必须为rows 对应easyui分页）
     */
    private List<T> rows = new LinkedList<T>();

    /**
     * 待封装的分页对象
     */
    // @JsonIgnore
    // private Page<T> page;

    public Pager(Page<T> page) {
        this.rows = page.getResult();
        this.numPerPage = page.getPageSize();
        this.totalPages = page.getPages();
        this.currentPage = page.getPageNum();
        this.startIndex = page.getStartRow();
        this.lastIndex = page.getEndRow();
        this.total = page.getTotal();
    }

    // setter and getter

    public int getNumPerPage() {
        return numPerPage;
    }

    public void setNumPerPage(int numPerPage) {
        this.numPerPage = numPerPage;
    }

    public int getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getStartIndex() {
        return startIndex;
    }

    public void setStartIndex(int startIndex) {
        this.startIndex = startIndex;
    }

    public int getLastIndex() {
        return lastIndex;
    }

    public void setLastIndex(int lastIndex) {
        this.lastIndex = lastIndex;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

}
